/**
 * $Revision: 1.0 $
 * $Author: Eric Yang $
 * $Date: Aug 2, 2009 3:46:13 PM $
 *
 * Author: Eric Yang
 * Date  : Aug 2, 2009 3:46:13 PM
 *
 */
package com.gooex.domain.organization;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Role Group
 * 
 * @author Eric Yang
 * @version 1.0
 */
public class Group extends AuthorizedObject implements Serializable {
	/** TODO comment */
	private Area area;

	/** TODO comment */
	private Group parentGroup;

	/** TODO comment */
	private List<Group> subGroups = new ArrayList<Group>();

	/** TODO comment */
	private List<Role> roles = new ArrayList<Role>();

	/** TODO comment */
	public void addSubGroup(Group group) {
		if (!subGroups.contains(group)) {
			subGroups.add(group);
			group.setParentGroup(this);
		}
	}

	/** TODO comment */
	public void addRole(Role role) {
		if (!roles.contains(role)) {
			roles.add(role);
			role.setGroup(this);
		}
	}

	public List<Role> getRoles() {
		return roles;
	}

	public void setRoles(List<Role> roles) {
		this.roles = roles;
	}

	public Group getParentGroup() {
		return parentGroup;
	}

	public void setParentGroup(Group parentGroup) {
		this.parentGroup = parentGroup;
	}

	public List<Group> getSubGroups() {
		return subGroups;
	}

	public void setSubGroups(List<Group> subGroups) {
		this.subGroups = subGroups;
	}

	public Area getArea() {
		return area;
	}

	public void setArea(Area area) {
		this.area = area;
	}
}
